<template>
  <div class="left-list-main">
    <ul class="bottom-list">
      <li class="header" v-if="details.teamName">{{ details.teamName }}团队</li>
      <li class="title" v-if="details.teamName">{{ details.teamName }}团队热点新闻</li>
      <li class="title" v-else>团队热点新闻</li>
      <li class="item" @click="$emit('clickItem',item)" v-for="(item,index) in hotNews" :key="index">
        <p class="item-title line-2">{{ $TOOL.richTextWithUrlsRemove(item.title) }}</p>
        <p class="time">{{ $TOOL.dateFormat(item.createDate, 'YYYY-MM-DD') }}</p>
      </li>
    </ul>
  </div>
</template>

<script setup>
import {homeApi} from "@/api";

const details = ref({})
const hotNews = ref([])

async function getTeamLstPage(data) {
  details.value = data
  const sendData = {
    type: 2,
    index: 1,
    moduleType: data.moduleType,
    teamId: data.teamId
  }
  const res = await homeApi.listPage.get(sendData)
  hotNews.value = res.data.sources
}

defineExpose({getTeamLstPage})
</script>

<style scoped lang="scss">
.left-list-main {
  min-width: 200px;
  width: 21%;

  .bottom-list {
    background: #FFFFFF;

    .header {
      width: 100%;
      padding: 24px 20px;
      background: $base-color;
      font-size: 30px;
      color: #FFFFFF;
    }

    .title {
      padding: 20px 10px;
      font-size: 20px;
      font-weight: bold;
      color: $base-color;
      border-bottom: 1px solid #c4c7c7;
    }

    .item {
      padding: 20px 10px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      border-bottom: 1px solid #f2f2f2;
      cursor: pointer;

      &:hover {
        font-weight: bold;

        .item-title {
          color: $base-color;
        }
      }

      &:last-child {
        border-bottom: 0px;
      }

      .item-title {
        font-size: 20px;
        color: #333333;
      }

      .time {
        font-size: 16px;
        color: #999999;
      }
    }
  }
}
</style>
